package myException.myRestfulGolbalException;

//import com.sinotrans.carbon.common.web.i18n.MessageUtils;
import org.springframework.util.StringUtils;

public enum ExceptionEnum {

    SUCCESS("200", "成功!"),
    BODY_NOT_MATCH("400", "请求的数据格式不符!"),
    SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"),
    PERMISSION_DENIED("403", "access denied"),
    SQL_ERROR("405", "数据库执行异常"),
    NOT_FOUND("404", "未找到该资源!"),
    INTERNAL_SERVER_ERROR("500", "服务器内部错误!"),
    BUSINESS_SERVER_ERROR("501", "业务异常!"),
    SERVER_BUSY("503", "服务器正忙，请稍后再试!");

    /**
     * 错误码
     */
    private final String resultCode;

    /**
     * 错误描述
     */
    private final String resultMsg;

    ExceptionEnum(String resultCode, String resultMsg) {
        this.resultCode = resultCode;
        this.resultMsg = resultMsg;
    }

//    @Override
//    public String getResultCode() {
//        return resultCode;
//    }
//
//    @Override
//    public String getResultMsg() {
//        String msg = MessageUtils.get(this.getClass().getSimpleName() + "_" + this.name());
//        if (StringUtils.hasText(msg)) {
//            return msg;
//        }
//        return this.resultMsg;
//    }
}
